package cn.edu.stu.syllabus.repository.library;

import javax.inject.Inject;

import cn.edu.stu.syllabus.di.qualifier.Remote;
import cn.edu.stu.syllabus.di.scope.FragmentScoped;
import cn.edu.stu.syllabus.repository.library.local.BooksResultEntry;
import rx.Observable;

/**
 * Created by daidaijie on 2017/3/27.
 */

@FragmentScoped
public class LibraryRepository implements LibraryDataSource {

    private LibraryDataSource mLibraryRemoteDataSource;

    @Inject
    public LibraryRepository(@Remote LibraryDataSource libraryRemoteDataSource) {
        mLibraryRemoteDataSource = libraryRemoteDataSource;
    }

    @Override
    public Observable<BooksResultEntry> getBooksResult(LibrarySearchInfo librarySearchInfo, int start, int pageNum) {
        return mLibraryRemoteDataSource.getBooksResult(librarySearchInfo, start, pageNum);
    }


    @Override
    public boolean isSourceEmpty(Throwable errMsg) {
        return mLibraryRemoteDataSource.isSourceEmpty(errMsg);
    }
}
